package com.lagou.biz.impl;

import java.util.ArrayList;
import java.util.List;

import com.lagou.biz.UBasicBiz;
import com.lagou.dao.UBasicDao;
import com.lagou.dao.impl.UBasicDaoImpl;
import com.lagou.entity.Position;
import com.lagou.entity.UBasic;
import com.lagou.entity.User;

public class UBasicBizImpl implements UBasicBiz {
	UBasicDao ubd = new UBasicDaoImpl();
	@Override
	public boolean saveUBasic(UBasic ubasic) {
		return ubd.saveUBasic(ubasic);
		 
	}

	@Override
	public boolean upadateBasic(UBasic ubasic) {
		
		return ubd.upadateBasic(ubasic);
	}

	@Override
	public List<Position> qureyAllCollect(int ubid) {
		// TODO Auto-generated method stub
		return ubd.qureyAllCollect(ubid);
	}

	@Override
	public boolean addCPosition(int pid, int ubid) {
		// TODO Auto-generated method stub
		return ubd.addCPosition(pid, ubid);
	}

	@Override
	public boolean deleteCPosition(int pid, int ubid) {
		// TODO Auto-generated method stub
		return ubd.deleteCPosition(pid, ubid);
	}


	@Override
	public UBasic queryByUid(int uid) {
		// TODO Auto-generated method stub
		return ubd.queryByUid(uid);
	}

	@Override
	public boolean addUBasic(int uid) {
		
		 return ubd.addUBasic(uid);
	}

	@Override
	public User queryByUbid(int uid) {
		// TODO Auto-generated method stub
		return ubd.queryByUbid(uid);
	}

	@Override
	public UBasic queryUByUbid(int ubid) {
		// TODO Auto-generated method stub
		return ubd.queryUByUbid(ubid);
	}

	@Override
	public int queryCCount() {
		// TODO Auto-generated method stub
		return ubd.queryCCount();
	}

	@Override
	public List<Position> qureyByPage(int page, int size,int ubid) {
		List<Position> list = new ArrayList<>();
		int count = queryCCount();
		int pageCount  = count%size==0?(count/size):(count/size+1);
		page=page<1?1:page;
		page=page>pageCount?pageCount:page;
		list = ubd.qureyByPage(page, size,ubid);
		return list;
	}



	
	
}
